/*    */ package cc.s2m.web.s2mBlog.controller.admin;
/*    */ 
/*    */ import cc.s2m.util.BeanConverter;
/*    */ import cc.s2m.util.Page;
/*    */ import cc.s2m.web.s2mBlog.controller.base.BaseController;
/*    */ import cc.s2m.web.s2mBlog.pojo.SysLog;
/*    */ import cc.s2m.web.s2mBlog.service.ISysLog;
/*    */ import java.util.HashMap;
/*    */ import java.util.Map;
/*    */ import org.apache.logging.log4j.LogManager;
/*    */ import org.apache.logging.log4j.Logger;
/*    */ import org.springframework.beans.factory.annotation.Autowired;
/*    */ import org.springframework.stereotype.Controller;
/*    */ import org.springframework.ui.Model;
/*    */ import org.springframework.web.bind.annotation.RequestMapping;
/*    */ import org.springframework.web.bind.annotation.ResponseBody;
/*    */ 
/*    */ @Controller("admin_SysLogController")
/*    */ @RequestMapping({"/admin/sysLog"})
/*    */ public class SysLogController extends BaseController
/*    */ {
/* 24 */   private static final Logger LOGGER = LogManager.getLogger(SysLogController.class);
/*    */ 
/*    */   @Autowired
/*    */   private ISysLog sysLogService;
/*    */ 
/* 31 */   @RequestMapping({"/list"})
/*    */   public String list(Model model, SysLog bean, Integer page) { if (page == null) page = Integer.valueOf(1);
/* 32 */     Map map = new HashMap();
/* 33 */     if (bean != null) {
/* 34 */       map.putAll(BeanConverter.toMap(bean, false));
/* 35 */       model.addAttribute("bean", bean);
/*    */     }
/* 37 */     Page pageBean = this.sysLogService.getPage(page.intValue(), 50, null, map);
/* 38 */     model.addAttribute("pageBean", pageBean);
/* 39 */     return "admin/sysLog"; }
/*    */ 
/*    */   @RequestMapping(value={"/add"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*    */   public String add(Model model, Integer id)
/*    */   {
/* 44 */     if (id != null) {
/* 45 */       SysLog bean = (SysLog)this.sysLogService.selectByPrimaryKey(id);
/* 46 */       model.addAttribute("bean", bean);
/*    */     }
/* 48 */     return "admin/sysLog_add";
/*    */   }
/*    */ 
/*    */   @RequestMapping(value={"/view"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*    */   public String view(Model model, Integer id) {
/* 53 */     if (id != null) {
/* 54 */       SysLog bean = (SysLog)this.sysLogService.selectByPrimaryKey(id);
/* 55 */       model.addAttribute("bean", bean);
/*    */     }
/* 57 */     return "admin/sysLog_view";
/*    */   }
/*    */   @RequestMapping(value={"/save"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*    */   @ResponseBody
/*    */   public String save(Model model, SysLog bean) {
/* 63 */     if (bean == null) {
/* 64 */       return "empty";
/*    */     }
/* 66 */     if (bean.getId() == null)
/*    */     {
/* 68 */       this.sysLogService.insertSelective(bean);
/*    */     }
/*    */     else {
/* 71 */       this.sysLogService.updateByPrimaryKeySelective(bean);
/*    */     }
/* 73 */     return "success";
/*    */   }
/*    */   @RequestMapping(value={"/del"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*    */   @ResponseBody
/*    */   public String del(Integer id) {
/* 79 */     SysLog bean = (SysLog)this.sysLogService.selectByPrimaryKey(id);
/* 80 */     if (bean != null) {
/* 81 */       this.sysLogService.deleteByPrimaryKey(id);
/*    */     }
/* 83 */     return "success";
/*    */   }
/*    */   @RequestMapping(value={"/clearLogs"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*    */   @ResponseBody
/*    */   public String clearLogs() {
/* 89 */     this.sysLogService.delete(new SysLog(), null);
/* 90 */     LOGGER.error("清空日志");
/* 91 */     return "success";
/*    */   }
/*    */ }

/* Location:           C:\Users\Administrator\Desktop\s2mBlog.zip
 * Qualified Name:     s2mBlog-3.0.0.WEB-INF.classes.cc.s2m.web.s2mBlog.controller.admin.SysLogController
 * JD-Core Version:    0.6.1
 */